﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

public partial class getCaptcha : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        WebControlCaptcha.CaptchaImage ci = new WebControlCaptcha.CaptchaImage();
        ci.Height = 60;
        ci.Width = 200;
        ci.BackgroundNoise = WebControlCaptcha.CaptchaImage.BackgroundNoiseLevel.High;
        ci.FontWarp = WebControlCaptcha.CaptchaImage.FontWarpFactor.Low;
        ci.LineNoise = WebControlCaptcha.CaptchaImage.LineNoiseLevel.Low;
        //ci.TextChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789";
        ci.TextLength = 5;
        //ci.Font = System.Drawing.FontFamily.GenericSerif.Name;
        
        this.Session["captcha"] = ci.Text;

        Bitmap b = ci.RenderImage();
        b.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
        b.Dispose();
        Response.ContentType = "image/jpeg";
        Response.StatusCode = 200;
        HttpContext.Current.ApplicationInstance.CompleteRequest();

    }
}
